package cn.tedu.spring.tools;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * Author：程Sir
 * Name： SpringTest01
 * Content:
 */

@PropertySource(value = "jdbc.properties")
@Component // 表示当前的类是可以被spring管理组件
public class JdbcSpring {
    @Value(value = "${jdbc.driver}") // 在注解参数的大括号中的值，是jdbc.properties文件中等号左侧的值
    private String driver;
    @Value(value = "${jdbc.url}")
    private String url;
    @Value(value = "${db.username}")
    private String username;
    @Value(value = "${db.password}")
    private String password;
    @Value("${db.maxActive}")
    private String maxActive;
    @Value("${db.initialSize}")
    private Integer initialSize;

    public String getMaxActive() {
        return maxActive;
    }

    public void setMaxActive(String maxActive) {
        this.maxActive = maxActive;
    }

    public Integer getInitialSize() {
        return initialSize;
    }

    public void setInitialSize(Integer initialSize) {
        this.initialSize = initialSize;
    }

    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "JdbcSpring{" +
                "driver='" + driver + '\'' +
                ", url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", maxActive=" + maxActive +
                ", initialSize=" + initialSize +
                '}';
    }
}
